import java.io.IOException;

import javax.swing.BorderFactory;
import javax.xml.bind.JAXBException;


public class Main {
	public static String string = "something else";

	public static int lastInClk = 0;
	public static int timeDiff = 0;
	
	public static MidiIn midiIn = new MidiIn();
//	public static ArmHandling armHandling = new ArmHandling();
	public static Improvise improvise = new Improvise();
	public static XML xml = new XML();
	public static StatisticGathering stats = new StatisticGathering();
//	public static SliderGUI sliderGUI= new SliderGUI();
	public static TextGUI textGUI = new TextGUI();
	public static int[][] notesArray = new int[50000][3];
	public static int notesArrayPointer = 0;
	public static Soloing soloing;
	public static boolean stillPlaying=false;
	
	public static int[][] learnArray = new int[50000][3];
	public static int learnArrayPointer = 0;
	public static boolean learning = true;

	public static int[][] learnArrayTemp = new int[50000][3];
	public static int learnArrayPointerTemp = 0;
	
	public static boolean firstNote = true;
	
	public static long lastTimeStamp=0;
	public static long timeStamp=0;
	
	public static boolean humanPlaying = true;

	public static boolean playing = true;
	
	public static int improvTime=0;
	
	public static int[] onsets = new int[0];
	public static int velocity = 60;
	
	public static void main(String args[]) {			
		
		try {
		xml.init();
		} catch (JAXBException e1) {
			e1.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}		
		OSCin.run();
   		String nameFormatted = "jazz";
		Main.improvise.name=nameFormatted;
		Main.improvise.styles[Main.improvise.stylePointer]=nameFormatted;
		Main.improvise.styleStrengths[Main.improvise.stylePointer]=50;
		Main.improvise.stylePointer=Main.improvise.stylePointer+1;
    
		Main.improvise.listening=false;
		Main.improvise.playing=false;
		Main.improvise.pointer=0;
		Main.improvise.stop=false;
//		try {
//			Main.improvise.start();
//		} catch (JAXBException e1) {
//			e1.printStackTrace();
//		}
		
		PlayCounter playCounter = new PlayCounter();
		Thread thread = new Thread(playCounter);
		thread.start();
	
        Main.textGUI.textArea.setText("improvising\n");
		
		Object[] oscArray = new Object[] {"NECK", 0.1};
		OSC.main(oscArray,"/head-commands");
		

	}
}
